<?php
require 'Model.php';
	class CommentModel extends Model{
		function __Construct(){
			parent::__Construct();
			$this->mod = 'comments';
		}

		function add($data){
			  $comment = array(
					'content' => trim($data['content']),  
					'sid' => $data['sid'],
					'cdate'=>$data['cdate']
			  	);
			  $keys = implode(',',array_keys($comment));
			  $values = implode("','", array_values($comment));
			  $sql="insert into {$this->mod} ({$keys}) VALUES ('{$values}')";
			  //执行SQL语句
				$result = $this->conn->query($sql);
					return $result;
			  
		}
	}
	?>